package com.mgy.shardingjdbc.test;

import com.mgy.db.TableRouter;
import com.mgy.db.sharding.annotation.MybatisMapper;
import com.mgy.db.sharding.aop.IShardingCallback;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;
import java.util.HashSet;
import java.util.Set;

/**
 * xxx
 *
 * @author maguoyong
 * @date 2019/12/4
 */
@Component
public class MyShardingCallback implements IShardingCallback {

    @Override
    public Set<TableRouter> getTableRouters(Method method, String[] parameterNames, Class[] parameterTypes, Object[] parameterValues, MybatisMapper mybatisMapper) {
        Set<TableRouter> tableRouters = new HashSet<>();
        TableRouter router = new TableRouter();
        router.setLogicTable("notepad");
        router.setDbNo(1);
        router.setTableNo(1);
        tableRouters.add(router);
        return tableRouters;
    }
}
